package com.wk.unreal.dingroomserver.controller;

import com.wk.unreal.dingroomserver.dto.Result;
import com.wk.unreal.dingroomserver.service.UsertblService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@Tag(name="UserController", description = "用户数据接口")
@RequestMapping("/user") // /user/xxx
public class UserController {

    @Autowired
    private UsertblService usertblService;

    @PostMapping("/login") // /user/login
    @Operation(description = "登入数据接口"
            , parameters = {
            @Parameter(name = "username", description = "登入名"),
            @Parameter(name="password", description = "登入密码")
    }
    )
    public Result login (String username, String password) {

        return usertblService.login(username, password);
    }


    @PostMapping("/password")
    public Result password () {
        return Result.success().data("修改密码");
    }

}
